#include <bits/stdc++.h>
using namespace std;
int n,r[100001],temp,c,ans;
vector<int> vec;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=0,temp=0;i<n;i++){
        scanf("%d",&temp);
        vec.push_back(temp);
    }
    ans=n;r[0]=1;
    sort(vec.begin(),vec.end());
    //for(vector<int>::iterator it=vec.begin();it!=vec.end();it++)cout<<*it<<' ';
    //cout<<endl;
    for(int i=1;i<vec.size();i++){
        if(vec[i]!=vec[i-1])c++;
        r[c]++;
    }
    //for(int i=0;i<c+1;i++)cout<<r[i]<<' ';
    //cout<<endl;
    int left=0;
    for(int i=1;i<c+1;i++){
        if(r[i]>=left){
            r[i]-=left;
            left=0;
        }
        else{
            left-=r[i];
            r[i]=left;
        }
        if(r[i]<r[i-1]){
            left+=r[i-1]-r[i];
            ans-=r[i];
        }
        else{
            ans-=r[i-1];
        }
    }
    printf("%d",ans);
    return 0;
}
